﻿@using ADShop.Repository;
@using ADShop.Models;
@{
    ShoppingCartModels models = new ShoppingCartModels();
    models.Cart = (ShoppingCart)Session["Cart"];       
}

@using (Html.BeginForm("ConfirmOrder", "Checkout", new { id = (Session["Member"] as Member).IDUser }, FormMethod.Post))
{ 
    <div id="content">
    <!--Breadcrumb Part Start-->
    <div class="breadcrumb"> <a href="index.html">Home</a> » <a href="">Shopping Cart</a></div>
    <!--Breadcrumb Part End-->
    <h1>Checkout</h1>
    <div class="checkout">
        <div class="checkout-heading">Step 1: Checkout Options</div>
        <div class="checkout-content" style="display: block;">
            @if(Session["Member"] == null)
            { 
               @Html.Partial("Partial/_PartialLogin")
            }
            else
            {
                Member member = Session["Member"] as Member;
                <b><font size="5">Thông Tin Khách Hàng</font></b><br />
                <font size="3">Họ : <b>@member.InfoMember.FirstName</b></font><br />
                <font size="3">Tên : <b>@member.InfoMember.LastName</b> </font><br />
                <font size="3">Số Điện Thoại : <b>@member.InfoMember.NumberPhone</b></font><br />
                <font size="3">Mã Thẻ Thành Viên : <b>@member.InfoMember.NumberCardMember</b></font><br />
                <font size="3">Địa Chỉ : <b>@member.InfoMember.Address</b></font><br />             
            }
        </div>
    </div>
    <div class="checkout">
        <div class="checkout-heading">Step 2: Shipping Details</div>
        <div class="checkout-content" style="display: none;">
            <table class="form">
                <tbody>
                    <tr>
                        <td><span class="required">*</span> Người Nhận : </td>
                        <td>@Html.TextBox("tbNguoiNhan", null, new { @class = "large-field" , required = "required" })</td>
                    </tr>
                    <tr>
                        <td><span class="required">*</span> Địa Chỉ:</td>
                        <td>@Html.TextBox("tbDiaChi", null, new { @class = "large-field", required = "required" })</td>
                    </tr>
                    <tr>
                        <td><span class="required">*</span> Email :</td>
                        <td>@Html.TextBox("tbEmail", null, new { @class = "large-field"})</td>
                    </tr>
                    <tr>
                        <td><span class="required">*</span> Số Điện Thoại :</td>
                        <td>@Html.TextBox("tbSoDienThoai", null, new { @class = "large-field" , required = "required" })</td>
                    </tr>
                    <tr>
                        <td><span class="required">*</span> Tin Nhắn :</td>
                        <td>@Html.TextBox("tbTinNhan", null, new { @class = "large-field"})</td>
                    </tr>
                </tbody>
               </table>
        </div>
    </div>
    <div class="checkout">
        <div class="checkout-heading">Step 3: Payment Method</div>
        <div class="checkout-content" style="display: none;">
            <p>Xin Vui Lòng Chọn Phương Thức Thanh Toán & Vận Chuyển</p>
            <table class="radio">
                <tbody>
                    <tr class="highlight">
                        <td>
                            @Html.DropDownList("ddlPaymentsMethod", (IEnumerable<SelectListItem>)ViewBag.PaymentsMethod)
                        </td>
                    </tr>
                    <tr class="highlight">
                        <td>
                            @Html.DropDownList("dllShipMethod", (IEnumerable<SelectListItem>)ViewBag.ShipMethod)
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
    </div>
    <div class="checkout">
        <div class="checkout-heading">Step 4: Confirm Order</div>
        <div class="checkout-content" style="display: none;">
            <div class="checkout-product">
                <table>
                    <thead>
                        <tr>
                            <td class="name">Product Name</td>
                            <td class="model">Model</td>
                            <td class="quantity">Quantity</td>
                            <td class="price">Price</td>
                            <td class="total">Total</td>
                        </tr>
                    </thead>
                    <tbody>
                        @if(models != null && models.Cart != null)
                        { 
                            foreach(var items in models.Cart.ListShoppingCartItems)
                            { 
                                <tr>
                                    <td class="name"><a href="#">@items.ProductName</a></td>
                                    <td class="model">@items.ProductID</td>
                                    <td class="quantity">@items.Quantity</td>
                                    <td class="price">@items.Price</td>
                                    <td class="total">@items.TotalPrice</td>
                                </tr>
                            }
                        }
                    </tbody>
                    <tfoot>
                        <tr>
                            <td class="price" colspan="4"><b>Total:</b></td>
                            <td class="total">
                            @if (models != null && models.Cart != null)
                            {
                                <b>@models.Cart.GetTotal() $</b>
                            }
                            else
                            {
                                <b>0</b>
                            }
                            </td>
                        </tr>
                    </tfoot>
                </table>
            </div>
        </div>
    </div>
</div>
    <div class="buttons">
    <div class="right">
        <text><b><font color="red">Lưu ý : Nhập đầy đủ thông tin trước khi xác nhận</font></b></text><br />
        <text><b><font color="red">Check * là những thông tin bắt buộc</font></b></text><br />
        <input type="submit" class="button" id="button-confirm" value="Confirm Order">
    </div>
</div>
}